package com.michael.aop.cglib;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;

@Aspect
public class AdviceAspectTest {
    @AfterReturning(value = "execution(String com.michael..getName())",returning = "returnValue")
    public void afterReturning(String returnValue){
        System.out.println("@AfterReturning(value=\"execution(String com.michael..getName())\",returning = \"returnValue\"");
        System.out.println("@AfterReturning returnValue = " + returnValue);
    }
    @Around(value = "execution(String com.michael..getName())")
    public Object around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        System.out.println("@Around(value = \"execution(String com.michael..getName())\")");
        System.out.println("@Around before");
        Object proceed = proceedingJoinPoint.proceed();
        System.out.println("@Around after");
        return proceed;
    }
}
